﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.Specialized;
using System.Net.Sockets;
using System.Net;
namespace CoVuaClient
{
    /// <summary>
    /// Interaction logic for XemDachSachNguoiChoiCaoDiem.xaml
    /// </summary>
    public partial class XemDachSachNguoiChoiCaoDiem : Window
    {
        public XemDachSachNguoiChoiCaoDiem(TcpClient client, NetworkStream stream)
        {
            InitializeComponent();
            _quanLiKetNoi = new QuanLiKetNoiClient(client, stream);
            
        }
        ShowItem showItem;
        QuanLiKetNoiClient _quanLiKetNoi;


        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            showItem = new ShowItem();
            showItem.CollectionChanged += new NotifyCollectionChangedEventHandler(showItem_CollectionChanged);
            _quanLiKetNoi.DanhSachNguoiChoiCaoDiem();
            for (int i = 0; i < 20; i++)
            {
                Item item = _quanLiKetNoi.RecieveUserInfo();
                item.ThuTu = (i + 1).ToString("00");
                showItem.Add(item);
            }
        }
        public void showItem_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            listBoxDanhSach.ItemsSource = null;
            listBoxDanhSach.ItemsSource = showItem;
        }

        private void buttonOK_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
